import asyncio

import aiohttp
import requests
import charset_normalizer

url = 'http://www.genisyscu.org'

# content = requests.get(url).content
# charset = charset_normalizer.detect(content)['encoding']
# print(content.decode(charset))

async def run():
    conn = aiohttp.TCPConnector(ssl=False)
    # 设置请求超时时间
    timeout = aiohttp.ClientTimeout(total=60)
    # 作为参数传入ClientSession
    async with aiohttp.ClientSession(trust_env=True, connector=conn, timeout=timeout) as a:
        async with a.get(url,headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36'
    }) as b:
            content = await b.content.read()
            charset = charset_normalizer.detect(content)['encoding']
            text = content.decode(charset)

asyncio.get_event_loop().run_until_complete(run())